<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/3 0003
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script>
        function delUser(userId) {
            if(confirm("确定要删除吗？")){
                location.href="${pageContext.request.contextPath}/user/delete/"+userId;
            }
        }
    </script>
</head>
<body>
<form>
    <a href="${pageContext.request.contextPath}/user/saveUI">添加</a>
    <table>
        <thead>
            <tr><td><input type="checkbox"></td><td>id</td><td>用户名</td><td>密码</td><td>邮箱</td><td>电话</td><td>角色</td><td>操作</td></tr>
        </thead>
        <tbody>
            <c:forEach items="${userList}" var="user">
                <tr><td><input type="checkbox"></td><td>${user.id}</td><td>${user.username}</td>
                    <td>${user.password}</td><td>${user.email}</td><td>${user.telephone}</td>
                    <td>
                        <c:forEach items="${user.roleList}" var="role">
                            &nbsp;&nbsp;${role.rolename}
                        </c:forEach>
                    </td><td><a href="" onclick="delUser('${user.id}')">删除</a></td></tr>
            </c:forEach>
        </tbody>
    </table>
</form>
</body>
</html>
